<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/react.development.js" ></script>
    <script type="text/javascript" src="../js/react-dom.development.js" ></script>
    <script type="text/javascript" src="../js/babel.min.js" ></script>
    <style>
        .title{
            background-color: orange;
            width:500px;
        }
    </style>
</head>
<body>
    <div id="test1"></div>
    <div id="test2"></div>
    <div id="test3"></div>
    <script type="text/babel">
        class MyComponent extends React.Component {
            render(){
                // 用props手机标签上传递的数据
                // 用结构赋值的方式，拿到对象里面的数据
                const {isHot} = this.props
                return (
                    <div>
                        <h1 className="title">
                            <span onClick={demo} style={{color:'white'}}>zzzzzzz{isHot?'热':'凉爽'}</span>
                        </h1>
                    </div>
                )
            }
        }
        ReactDOM.render(<MyComponent isHot='false' />,document.getElementById('test1'))
        ReactDOM.render(<MyComponent isHot='true' />,document.getElementById('test2'))
        ReactDOM.render(<MyComponent isHot='true' />,document.getElementById('test3'))
        
        const p = {isHot:true}
        ReactDOM.render(<MyComponent {...p} />,document.getElementById('test3'))


    </script>
</body>
</html>